Index | Conventions

api/v1/jobs/{jobno}/timers

Path: api/v1/jobs/{jobno}/timers

This API is JSON:API compliant.

This endpoint supports the following methods:
GET POST PATCH

This endpoint requires an OAuth bearer token, and returns errors in a standard shape. See API Conventions for authentication, error responses and paging, which apply to every endpoint.

The resource type for this endpoint is JobTimer
The identifier is jobno-refno

Attributes

The JobTimer resource type attributes are as follows:

AttributeTypeRead-onlyDescription
CommentstringThe timer comment.
LabourInitstringThe initials of the staff member the timer is for. Defaults to the current user if not supplied.
LabourTypestringThe labour type for the timer. Defaults to the user's labour type if not supplied.
LineNumintegerThe line number of the timer on the job.
StatestringMust be left out or null when creating a timer. Otherwise may be Paused, Resumed, or Stopped. Note once stopped the timer will cease to exist (it become a simple labour entry on the job).

Example GET (Return specific)

Path: api/v1/jobs/10/timers/10-1

Response:

This example shows the maximum set of fields the endpoint can return, all populated. A real response only contains the data that applies to that record, so fields that are empty or not relevant are omitted — do not assume every field shown here will be present in every response.

{
  "data": {
    "id": "10-1",
    "type": "JobTimer",
    "attributes": {
      "LabourInit": "SYS",
      "Comment": "Onsite diagnostics",
      "LabourType": "Admin",
      "State": "Resumed",
      "LineNum": 2
    },
    "links": {
      "self": "/api/v1/jobs/10/timers/10-1"
    }
  }
}

Example POST

Path: api/v1/jobs/10/timers

Request:

{
    "data": {
        "type": "JobTimer",
        "attributes": {
            "LabourInit": "SYS",
            "Comment": "Timer started for diagnostics.",
            "LabourType": "Admin"
        }
    }
}

Response:

This example shows the maximum set of fields the endpoint can return, all populated. A real response only contains the data that applies to that record, so fields that are empty or not relevant are omitted — do not assume every field shown here will be present in every response.

{
    "data": {
        "id": "10-3",
        "type": "JobTimer",
        "attributes": {
            "LabourInit": "SYS",
            "Comment": "Test",
            "LabourType": "Admin",
            "State": "Resumed",
            "LineNum": 3
        },
      "links": {
        "self": "/api/v1/jobs/10/timers/10-3"
      }
    }
}

Example PATCH

Path: api/v1/jobs/10/timers/10-1

Request:

{
    "data": {
        "id": "1",
        "type": "JobTimer",
        "attributes": {
            "LabourInit": "SYS",
            "Comment": "Timer running for diagnostics.",
            "LabourType": "Admin",
            "State": "Resumed"
        }
    }
}

Response:

This example shows the maximum set of fields the endpoint can return, all populated. A real response only contains the data that applies to that record, so fields that are empty or not relevant are omitted — do not assume every field shown here will be present in every response.

{
  "data": {
    "id": "10-1",
    "type": "JobTimer",
    "attributes": {
      "LabourInit": "SYS",
      "Comment": "Test",
      "LabourType": "Admin",
      "State": "Resumed",
      "LineNum": 1
    },
    "links": {
      "self": "/api/v1/jobs/10/timers/10-1"
    }
  }
}